/*
 * $Id$
 *
 * Copyright ( c ) 2014 XuNuo Corporation. All Rights Reserved.
 *
 * This software is the confidential and proprietary information of XuNuo
 * Corporation ("Confidential Information").  You shall not disclose such
 * Confidential Information and shall use it only in accordance with the terms
 * of the license agreement you entered into with XuNuo Corporation or a XuNuo
 * authorized reseller (the "License Agreement"). XuNuo may make changes to the
 * Confidential Information from time to time. Such Confidential Information may
 * contain errors.
 *
 * EXCEPT AS EXPLICITLY SET FORTH IN THE LICENSE AGREEMENT, XuNuo DISCLAIMS ALL
 * WARRANTIES, COVENANTS, REPRESENTATIONS, INDEMNITIES, AND GUARANTEES WITH
 * RESPECT TO SOFTWARE AND DOCUMENTATION, WHETHER EXPRESS OR IMPLIED, WRITTEN OR
 * ORAL, STATUTORY OR OTHERWISE INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A
 * PARTICULAR PURPOSE. XuNuo DOES NOT WARRANT THAT END USER'S USE OF THE
 * SOFTWARE WILL BE UNINTERRUPTED, ERROR FREE OR SECURE.
 *
 * XuNuo SHALL NOT BE LIABLE TO END USER, OR ANY OTHER PERSON, CORPORATION OR
 * ENTITY FOR INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL
 * DAMAGES, OR DAMAGES FOR LOSS OF PROFITS, REVENUE, DATA OR USE, WHETHER IN AN
 * ACTION IN CONTRACT, TORT OR OTHERWISE, EVEN IF XuNuo HAS BEEN ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGES. XuNuo' TOTAL LIABILITY TO END USER SHALL NOT
 * EXCEED THE AMOUNTS PAID FOR THE XuNuo SOFTWARE BY END USER DURING THE PRIOR
 * TWELVE (12) MONTHS FROM THE DATE IN WHICH THE CLAIM AROSE.  BECAUSE SOME
 * STATES OR JURISDICTIONS DO NOT ALLOW LIMITATION OR EXCLUSION OF CONSEQUENTIAL
 * OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT APPLY TO END USER.
 *
 * Copyright version 2.0
 */
package com.th.supcom.pds.impl.common.enums;

/**
 * TODO
 * 
 * @author leaqua@qq.com
 * @version PTS
 */
public enum TransferActionEnum
{
    /**
     * 报病危. (value = "A")
     */
    CriticalCondition ("A", "报病危"),
    /**
     * 报病重. (value = "B")
     */
    SevereCondition ("B", "报病重"),
    /**
     * 新入. (value = "C")
     */
    NewIn ("C", "新入"),
    /**
     * 取消新入. (value = "D")
     */
    CancelNewIn ("D", "取消新入"),
    /**
     * 转科. (value = "E")
     */
    Transfer ("E", "转科"),
    /**
     * 出院. (value = "F")
     */
    Discharge ("F", "出院"),
    /**
     * 转院. (value = "G")
     */
    TransferHospital ("G", "转院"),
    /**
     * 死亡. (value = "H")
     */
    Deceased ("H", "死亡"),
    /**
     * 取消病危. (value = "I")
     */
    CancelCritical ("I", "取消病危"),
    /**
     * 取消病重. (value = "J")
     */
    CancelSevere ("J", "取消病重"),
    /**
     * 转科入床. (value = "K")
     */
    TransferInBed ("K", "转科入床"),
    /**
     * 取消转科入床. (value = "L")
     */
    CancelTransferInBed ("L", "取消转科入床"),
    /**
     * 取消转科. (value = "M")
     */
    CancelTransfer ("M", "取消转科"),
    /**
     * 取消出院. (value = "N")
     */
    CancelDischarge ("N", "取消出院"),
    /**
     * 删除新入. (value = "O")
     */
    DeleteNewIn ("O", "删除新入"),
    /**
     * 换床. (value = "P")
     */
    ChangeBed ("P", "换床"),
    /**
     * 换病区. (value = "S")
     */
    ChangeWard ("S", "换病区"),

    /**
     * 转入. (value = "T")
     */
    TransferIn ("T", "转入"),
    /**
     * 转出. (value = "U")
     */
    TransferOut ("U", "转出"),

    /**
     * 换病区转入. (value = "Y")
     */
    ChangeWardIn ("Y", "换病区转入"),
    /**
     * 换病区转出. (value = "X")
     */
    ChangeWardOut ("X", "换病区转出"),

    /**
     * 换病区入床. (value = "V")
     */
    ChangeWardInBed ("V", "换病区入床"),
    /**
     * 取消换病区. (value = "X")
     */
    CancelChangeWard ("X", "取消换病区"),

    /**
     * 变更三级医师. (value = "Q")
     */
    ChangeDoctor ("Q", "变更三级医师");

    private final String m_value;
    private final String m_name;

    private TransferActionEnum (String value, String name)
    {
        this.m_value = value;
        this.m_name = name;
    }

    public String getValue ()
    {

        return m_value;
    }

    public String getName ()
    {
        return m_name;
    }

    public static TransferActionEnum getTransferActionEnumByCode (String code)
    {
        if (null == code || 0 == code.length ())
        {
            throw new RuntimeException ("入出转操作动作编码错误!");
        }

        TransferActionEnum tae = null;
        for (TransferActionEnum e : TransferActionEnum.values ())
        {
            if (e.getValue ().equals (code))
            {
                tae = e;
                break;
            }
        }
        if (tae == null)
        {
            throw new RuntimeException ("未找到【" + code + "】对应的入出转操作动作！");
        }
        return tae;
    }

}
